import request from '@/utils/request'
import { type Result } from '@/types/result'

// 获取当前用户的所有聊天列表
export function getMyChatListApi(): Promise<Result> {
  return request.get('/chat/list/all');
}

// 创建聊天列表
export function createChatListApi(toUserId: string, productId:string): Promise<Result> {
  return request.post('/chat/list', { toUserId, productId });
}

// 获取聊天详情
export function getChatDetailApi(productId: string, toUserId: string): Promise<Result> {
  return request.get('/chat/list/getId', { params: { productId, toUserId } })
}

// 获取私信未读消息总数
export function getPrivateLetterNoreadCountApi(): Promise<Result> {
  return request.get('/chat/list/noRead')
}


// 根据聊天列表 ID 删除聊天列表
export function deleteChatListApi(chatListId: string): Promise<Result> {
  return request.delete(`/chat/list/${chatListId}`);
}
